<h1>Результаты опроса</h1>

<div class="page_nav"><div><a href="/">Главная</a> » Результаты опроса</div></div>

<script language="javascript">
$(document).ready(function() {ldelim}
	$('#post').limit({$poll->comment_max_chars},'#charsLeft_new');
	
	$('#new').submit(function() {ldelim}
		if ($('#post_title').val() == '') {ldelim}
			alert('{#POLL_ERROR_NO_TITLE#}');
			$('#post_title').focus();
			return false;
		{rdelim}
		var pftext = $('#new textarea').val();
		if (pftext.length < 10) {ldelim}
			alert("{#POLL_ERROR_NO_TEXT#}");
			$('#new textarea').focus();
			return false;
		{rdelim}
		if ($('#securecode').val() == '') {ldelim}
			alert("{#POLL_ERROR_NO_SCODE#}");
			$('#securecode').focus();
			return false;
		{rdelim}
	{rdelim});
	
setClickable();
	
{rdelim});


function cAction(obj,action){ldelim}
	var cid = $(obj).parents('dt').attr('id');
	
/*
	if (action=='answer'){ldelim}
		$('#parent_id').val(cid);
		$('#mod_comment_new').insertAfter('#'+cid);
		return;
	{rdelim}
*/
		$.get('index.php',{ldelim}
			module: 'poll',
			action: action,
			pid: cid
		{rdelim},function(){ldelim}
			if (action=='delete'){ldelim}
				$(obj).parents('dt').eq(0).remove();
			{rdelim}
			if (action=='unlock'){ldelim}
				$(obj).unbind('click')
					.click(function(){ldelim}cAction(obj,'lock');{rdelim})
					.attr('title',"lock")
					.find('img').attr('src','modules/poll/templates/images/lock.gif');
			{rdelim}
			if (action=='lock'){ldelim}
				$(obj).unbind('click')
					.click(function(){ldelim}cAction(obj,'unlock');{rdelim})
					.attr('title',"Unlock")
					.find('img').attr('src','modules/poll/templates/images/unlock.gif');
			{rdelim}
		{rdelim});
{rdelim};


function setClickable(){ldelim}
		$('.mod_comment_delete').click(function(){ldelim}cAction(this,'delete');{rdelim});
		$('.mod_comment_lock').click(function(){ldelim}cAction(this,'lock');{rdelim});
		$('.mod_comment_unlock').click(function(){ldelim}cAction(this,'unlock');{rdelim});
{rdelim};


</script>



<fieldset>
<legend>Опрос</legend>
{if $norezult == '1'}
	<p>Статистика данного опроса закрыта для просмотра посетителями.</p>
	
{else}
<p>{$poll->poll_title|escape}</p>


	<table width="100%" border="0" cellpadding="5" cellspacing="1">
		<col width="50%">
		<col width="5%">
		<col width="40%">
		<col width="5%">
		<thead>
			<tr>
				<th>{#POLL_QUESTION_LIST#}</th>
				<th  colspan="3">{#POLL_RESULT_INFO#}</th>
			</tr>
		</thead>
		{foreach from=$poll->items item=item}
			<tr class="{cycle name="1" values=",odd"}">
				<td>{$item->poll_item_title|escape}</td>
				<td><div align="center"> {$item->poll_item_hits} </div></td>
				<td >
					<div style="width:100%;height:12px;padding:0">
						<div style="width:{if $item->sum!=""}{$item->sum}%{else}1%{/if};height:12px;background-color:{$item->poll_item_color}">
						</div>
					</div>
				</td>
				<td  class="{cycle name="pollerg4" values="mod_poll_first,mod_poll_second"}" width="5%" nowrap="nowrap"><div align="center"> {$item->sum} %</div></td>
			</tr>
		{/foreach}
	</table>
<br/>

	<table cellpadding="0" cellspacing="1" class="dopinfo">
		<col width="170">
		<thead>
			<tr>
				<th colspan="2">{#POLL_INFOS#}</th>
			</tr>
		</thead>
		<tr class="odd">
			<td>{#POLL_ALL_HITS#}</td>
			<td>{$poll->votes}</td>
		</tr>

		<tr >
			<td>{#POLL_PUB_STATUS#}</td>
			<td>{if $poll->poll_end > $smarty.now}Опрос активен.{else}Опрос НЕактивен.{/if}</td>
		</tr>

		<tr class="odd">
			<td>{#POLL_STARTED#}</td>
			<td>{$poll->poll_start|date_format:$TIME_FORMAT|pretty_date}</td>
		</tr>

		<tr >
			<td>{#POLL_ENDED#}</td>
			<td>{$poll->poll_end|date_format:$TIME_FORMAT|pretty_date}</td>
		</tr>

	</table>
{/if}
</fieldset>


	
	


	
{*
	{if $poll->can_vote == 1}
		<br />
		<div style="padding:5px"><strong>{$poll->poll_title|escape}</strong></div>
		<form method="post" action="{$poll->formaction}">
			{foreach from=$poll->items item=item}
				<div style="margin-left:5px"><input type="radio" name="p_item" value="{$item->id}" /> {$item->poll_item_title|escape}</div>
			{/foreach}
			<div style="padding:5px"><input type="submit" class="button" value="{#POLL_BUTTON_VOTE#}" /></div>
		</form>
	{/if}

</div>

*}	















{if $poll->poll_can_comment == 1}
	<h1>{#POLL_PUB_COMMENTS#}</h1>

	<a href="{$poll->link_result}#new">{#POLL_PUB_ADD_COMMENT#}</a> | {#POLL_ALL_COMMENTS#} {$poll->count_comments}<br />
	<br />

	<dl>

	{foreach from=$poll->comments item=comment}
	
	
				    <dt id="{$comment->id}">
				    {if $comment->no_moderate == '1'}
				    	<span class="no_moderate2"><div>Ваш комментарий не проверен модератором<br/>и не доступен для просмотра другим пользователям</div></span>
				    {/if}
				    <span class="icon"></span>{$comment->poll_comment_text}
				    <div class="info_block_dop faq_dop">
				   	 {$comment->poll_comment_time|date_format:$DATE_FORMAT|pretty_date} 
				   	 {if $comment->poll_comment_title!=''} | <span>{$comment->poll_comment_title|escape}</span>{/if}
				    </div>
				    
				    {if $smarty.const.UGROUP==1}
				    <div style="text-align:right">
				    
						<a  class="popup mod_comment_delete"  href="javascript:void(0);">
							<img src="modules/poll/templates/images/trash.gif" alt="" border="0" /><span>{#COMMENT_DELETE_LINK#}</span>
						</a>
						
						{if $comment->poll_comment_active!=1}
							&nbsp;<a  class="popup mod_comment_unlock" href="javascript:void(0);">
								<img src="modules/poll/templates/images/unlock.gif" alt="" border="0" /><span>{#COMMENT_UNLOCK_LINK#}</span>
							</a>
						{else}
							&nbsp;<a  class="popup mod_comment_lock" href="javascript:void(0);">
								<img src="modules/poll/templates/images/lock.gif" alt="" border="0" /><span>{#COMMENT_LOCK_LINK#}</span>
							</a>
						{/if}	
				    </div>	
					{/if}
		
				    </dt>	

	{/foreach}
	</dl>
	{if $poll->can_comment == 1}
		<br />
<div id="mod_comment_new" class="box">	
<h2>
	
</h2>
<fieldset>
<legend>Написать новый комментарий</legend>		
		<small>Что бы оставить комментарий, заполните поля ниже. Все комментарии проходят обязательную проверку модератором.</small>
		<form id="new" method="post">
			<input name="sub" type="hidden" value="new" />


				<p>
					<label>Ваше имя: </label>
					<input type="text" name="comment_title" id="post_title" class="inputfield" size="80" value="{$smarty.post.comment_title|escape|stripslashes}" />
				</p>
				<p>
					<label>Сообщение: </label>
					<textarea id="post" name="comment_text" cols="90" rows="5">{$smarty.post.comment_text|escape|stripslashes}</textarea><br>
					<label class="notice">Осталось символов: <span id="charsLeft_new"></span></label>
				</p>
				<div class="clear" style="height: 10px;"></div>
					<p>
						<label>Защитный код: </label>
						<span id="captcha"><img src="/inc/captcha.php" alt="" width="120" height="60" border="0" /><a href="javascript:void(0)" onclick="getCaptha()">обновить код</a></span> 
					</p>
					<p>
						<label for="securecode">Введите код: </label>
						<input name="securecode" type="text" id="securecode" maxlength="10" /><br />
					</p>
				
					<p>
						<input name="submit" type="submit" class="confirm button" value="{#POLL_BUTTON_ADD_C#}" />
						<input class="button" id="buttonReset" type="reset">
					</p>
		</form>
</fieldset>
</div>		

		<script>
		$(document).ready(function(){ldelim}
			$('#new').submit(function(){ldelim}
				$(this).ajaxSubmit({ldelim}
					url: aveabspath+'index.php?module=poll&action=result&pid={$poll->id}&ajax=1',
					success: function(){ldelim}
						target = $('h6').offset().top;
						$("html").animate({ldelim}scrollTop: target{rdelim}, 1100);
					{rdelim},
					timeout: 3000
				{rdelim});
				return false;
			{rdelim});
		{rdelim});
		</script>
	{/if}
{/if}
{*
</div>
*}